//导入 produce 函数.  produce 生产
import {produce} from "immer"

//声明一个数组
const baseState = [
  {
      title: "Learn TypeScript",
      done: true
  },
  {
      title: "Try Immer",
      done: false
  }
];

//  draft 草稿
const nextState = produce(baseState, draft => {
  // console.log(JSON.parse(JSON.stringify(draft)));
    draft[1].done = true
    draft.push({title: "Tweet about it"})
});

//
console.log(nextState === baseState);